package cz.acies.data.persist;

import java.util.Map;

public class Person extends ModelObject
{
	private static final long serialVersionUID = -2434472261076599568L;
	
	private String firstName;
	private String lastName;
	private String email;
	
	public Person() {
		this(null, null);
	}

	public Person(String id) {
		this(id, null);
	}

	public Person(String id, Map<String, Object> data) {
		super(id, data);
	}

	// -----  -----------------------------------------------------------------

	public String getFirstName() {
		return (String) getValidObject(firstName, "firstName"); 
	}

	public boolean hasFirstName() {
		return (this.getFirstName() != null && this.getFirstName().length() > 0);
	}

	public void setFirstName(String firstName) {
		setValidObject(this.firstName, firstName, "firstName");
	}

	public String getLastName() {
		return (String) getValidObject(lastName, "lastName");
	}
	
	public boolean hasLastName() {
		return (this.getLastName() != null && this.getLastName().length() > 0);
	}

	public void setLastName(String lastName) {
		setValidObject(this.lastName, lastName, "lastName");
	}
	
	public String getEmail() {
		return (String) getValidObject(email, "email");
	}

	public boolean hasEmail() {
		return (this.getEmail() != null && this.getEmail().length() > 0);
	}

	public void setEmail(String mail) {
		setValidObject(this.email, mail, "email");
	}
	
	// -----  -----------------------------------------------------------------
	
	@Override
	public String toString() {
		if (this.firstName == null) return "";
		return this.firstName + "";
	}



}
